﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace QuanLyThuNgan
{
    public class DichVuDAO
    {
        public bool m_Insert(DichVuDTO _info)
        {
            int iguidi = 0;
            int istop = 0;
            if (_info.Bguidi == true)
                iguidi = 1;
            if (_info.Bstopsd == true)
                istop = 1;
            string _sql = string.Format("usp_ThuNgan_DMDichVu_InsertData '{0}',N'{1}',N'{2}',{3},'{4}','{5}',{6},{7},{8},'{9}','{10}','{11}','{12}'", _info.Sdvucode, _info.STenDichVu, _info.Stendvu, _info.Ifee, _info.Sloaidvu, _info.Snhomdvu, iguidi, _info.Igiabhyt, istop, _info.Sloaidvu1, _info.IIDNoiGuiDichVu, _info.IIDNhomVSGPB, _info.SMaBHYT);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }
        public bool m_Update(DichVuDTO _info)
        {
            int iguidi = 0;
            int istop = 0;
            if (_info.Bguidi == true)
                iguidi = 1;
            if (_info.Bstopsd == true)
                istop = 1;
            string _sql = string.Format("usp_ThuNgan_DMDichVu_Update {0},'{1}',N'{2}',N'{3}',{4},'{5}','{6}',{7},{8},{9},'{10}','{11}','{12}','{13}' ", _info.Idvuid, _info.Sdvucode, _info.STenDichVu, _info.Stendvu, _info.Ifee, _info.Sloaidvu, _info.Snhomdvu, iguidi, _info.Igiabhyt, istop, _info.Sloaidvu1, _info.IIDNoiGuiDichVu, _info.IIDNhomVSGPB, _info.SMaBHYT);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }
        public bool m_Delete(DichVuDTO _info)
        {
            string _sql = string.Format("usp_ThuNgan_DMDichVu_Delete {0}", _info.Idvuid);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }

        public DataTable m_SelectAllDichVu()
        {
            string _sql = string.Format("usp_ThuNgan_DMDichVu_SelectAll ");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }

        public DataTable m_SelectNhomDichVu()
        {
            string _sql = string.Format("usp_ThuNgan_NhomDichVu_SelectTen");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }
    }
}
